const baseURl = '/h5api'

export function uniRequest(url = '', callback = "", method = 'GET', data = "") {
  const token = uni.getStorageSync('token');
  uni.request({
    url: baseURl + url,
    method: method,
    header: {
      token: token
    },
    data: data,
    success(res) {
      // console.log(res)
      if (res.data.code == 1) {
        callback(null, res.data.data);
      } else {
        callback(res.data.msg, null);
      }
    },
    fail(res) {
      callback('请求失败', null);
    }
  })
}